package 数论;

import java.util.ArrayList;
import java.util.Scanner;

public class 质数 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int count = 0;
        for (int i = 2; i < N; i++) {
            if (isFlg(i)) {
                System.out.print(i + " ");
                count++;
            }
        }

        System.out.println("\n" + count);
    }

    static boolean isFlg(int num) {
        for (int i = 2; i <= Math.sqrt(num); i++) {
            if (num % i == 0) {
                return false;
            }
        }
        return true;
    }

}
